package com.example.demo.zabbix.request.builder.host;

import com.example.demo.zabbix.request.BaseRequest;
import com.example.demo.zabbix.request.builder.request.RequestBuilder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api/reference/host/massupdate
 */
public class HostMassUpdateRequestBuilder extends RequestBuilder<Map<String,Object>> {
    private List<Map<String,Object>> hosts;
    public HostMassUpdateRequestBuilder(String auth) {
        super("host.massupdate", auth);
        baseRequest.setParams(new HashMap<>());
    }

    public HostMassUpdateRequestBuilder(Long id, String auth) {
        super("host.massupdate", id, auth);
        baseRequest.setParams(new HashMap<>());
    }

    public List<Map<String, Object>> getHosts() {
        return hosts;
    }

    public HostMassUpdateRequestBuilder setHosts(List<Map<String, Object>> hosts) {
        this.hosts = hosts;
        return this;
    }

    public HostMassUpdateRequestBuilder setParam(String key, Object value){
        baseRequest.getParams().put(key,value);
        return this;
    }

    public HostMassUpdateRequestBuilder setParams(Map<String,Object> params){
        baseRequest.getParams().putAll(params);
        return this;
    }

    @Override
    public BaseRequest<Map<String, Object>> builder() {
        baseRequest.getParams().put("hosts",hosts);
        return baseRequest;
    }
}
